doctype html
html(lang="en")
  head
    meta(charset="UTF-8")
    meta(name="viewport" content="width=device-width, initial-scale=1.0")
    title API Logs
    link(rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.1/css/bootstrap.min.css")
  body
    div(class="container-fluid mt-5") 
      h1(class="mb-4 text-center") API Logs 
      if logs.length
       div(class='table-responsive')
        table(style="width: 100%; border: 1px solid #dee2e6;" class="table table-striped  table-hover")
          thead(class="table-dark" style="text-align:center;") 
            tr
              th(scope="col") 调用时间
              th(scope="col") 调用方式
              th(scope="col") 调用路径
              th(scope="col") 调用状态
              th(scope="col") 参数
              th(scope="col") 调用异常
          tbody
            each log in logs
              tr(style="background-color: #{log.responseStatus >= 400 ? '#ffc8c8' : '#c8ffc8'};text-align:center;height:40px")
                td
                  | #{new Date(log.timestamp).toLocaleString()}
                if log.method == 'GET'
                  td
                    span(class='bg-success text-white badge')=log.method
                else if log.method == 'POST'
                  td
                    span(class='bg-primary text-white badge')=log.method
                else if log.method == 'PUT'
                  td
                    span(class='bg-warning text-white badge')=log.method
                else if log.method == 'DELETE'
                  td 
                    span(class='bg-danger text-white badge')=log.method
                td= log.url
                if log.responseStatus == '200'
                    td
                     span(class='text-success  badge')=log.responseStatus
                else if log.responseStatus == '500'
                    td
                     span(class='text-danger  badge')=log.responseStatus
                if log.requestBody != '{}' 
                  td=log.requestBody
                if log.error != '' && log.error != null
                  td(class='bg-danger text-white')=log.error
                
      else
        p(class="text-center") No logs available.